﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DK.RingLinkedList;


public class LinkedNode<T>
{
    public int Index { get; internal set; }
    public T? Data { get; internal set; }
    public LinkedNode<T> Next { get; internal set; }

    public LinkedNode(int index, T? data)
    {
        Index = index;
        Data = data;
    }

    public LinkedNode(int index, T? data, LinkedNode<T> next)
    {
        Index = index;
        Data = data;
        Next = next;
    }

    public override string ToString()
    {
        return string.Format("Index:[{0}],Data:[{1}],Next:[{2}]", Index, Data?.ToString() ?? "null", Next != null);
    }

}


